﻿using Lis.Dto;
using Lis.IDAL;
using Lis.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Lis.KISSFRSTDAL
{
    public class CirculateDal : BaseDal<LoanBookDto>, ICirculateDal
    {
        #region 01，根据读者卡号获取当前借阅信息+IEnumerable<LoanBookDto> GetEntitiesOfLoanByUserName(string userName)
        /// <summary>
        /// 根据读者卡号获取当前借阅信息
        /// </summary>
        /// <param name="userName">读者卡号</param>
        /// <returns></returns>
        public IEnumerable<LoanBookDto> GetEntitiesOfLoanByUserName(string userName)
        {
            return DB.QueryEntities<LoanBookDto>("Lis.Circulate.Select.Loan", new { DZTM = userName });
        } 
        #endregion
        #region 02，根据读者卡号获取借阅历史+IEnumerable<LoanBookDto> GetEntitiesOfLoanHistoryByUserName(string userName)
        /// <summary>
        /// 根据读者卡号获取借阅历史
        /// </summary>
        /// <param name="userName">读者卡号</param>
        /// <returns></returns>
        public IEnumerable<LoanBookDto> GetEntitiesOfLoanHistoryByUserName(string userName)
        {
            return DB.QueryEntities<LoanBookDto>("Lis.Circulate.Select.LoanHistory", new { DZTM = userName, CZLXDM = "HH" });
        } 
        #endregion
        #region 03，分页查询+override IQueryable<LoanBookDto> GetPageEntities<S>(int pageSize, int pageIndex, out int total, bool isAsc, System.Linq.Expressions.Expression<Func<LoanBookDto, bool>> whereLambda, System.Linq.Expressions.Expression<Func<LoanBookDto, S>> orderByLambda)
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <typeparam name="S"></typeparam>
        /// <param name="pageSize">页大小</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="total">总条数</param>
        /// <param name="isAsc">是否倒序</param>
        /// <param name="whereLambda">查询lambda</param>
        /// <param name="orderByLambda">排序lambda</param>
        /// <returns></returns>
        public override IQueryable<LoanBookDto> GetPageEntities<S>(int pageSize, int pageIndex, out int total, bool isAsc, System.Linq.Expressions.Expression<Func<LoanBookDto, bool>> whereLambda, System.Linq.Expressions.Expression<Func<LoanBookDto, S>> orderByLambda)
        {
            throw new NotImplementedException();
        } 
        #endregion
    }
}
